package com.example.pertecttime.fragent.timeline;

import android.util.Log;

import com.example.pertecttime.entity.User;
import com.example.pertecttime.entity.test;

/**
 * Created by 半生瓜 on 2017/7/21.
 */

public class TimelinePresent extends TimelineContract.Presenter {
    @Override
    void dotest(test t) {

        rxManager.add(modle.gettest(t)
                .subscribe(testBaseResult -> {
                            Log.i("login", "登陆" + testBaseResult);
                            view.onresult(String.valueOf(testBaseResult.getErrorCode()));
                        },
                        e ->
                        {
                            e.printStackTrace();
                            Log.d("错误", e.getMessage());
                            view.onresult(e.getMessage());
                        }
                ));
    }

    @Override
    void dologin(User t) {
        rxManager.add(modle.login(t)
                .subscribe(userBaseResult -> {
                            Log.i("login", "登陆" + userBaseResult);
                            view.onresult(String.valueOf(userBaseResult.getErrorCode()));
                        },
                        e ->
                        {
                            e.printStackTrace();
                            Log.d("错误", e.getMessage());
                            view.onresult(e.getMessage());

                        }));
    }
}
